<div class="discussion-content" id="{{id}}_discussion_content">
  <div class="discussion-row{{#if ENV.permissions.publish}} {{#if published}}discussion-published{{else}}discussion-unpublished{{/if}}{{/if}}">
    {{#if permissions.moderate}}
      <div class="draggable-handle">
        {{> icons/drag-handle}}
      </div>
    {{/if}}

    <div class="discussion-type">
      {{#if assignment}}
        {{#if assignment.peer_reviews}}
          {{> icons/peer-review}}
        {{/if}}
        {{> icons/assignment}}
      {{/if}}
    </div>

    <div class="discussion-title">
      <h3 class="inline-block discussion-title-block">
        {{#if assignment}}
          {{#if assignment.peer_reviews}}
            <span class="screenreader-only">{{#t}}Peer-reviewed graded discussion: {{/t}}</span>
          {{else}}
            <span class="screenreader-only">{{#t}}Graded discussion: {{/t}}</span>
          {{/if}}
        {{/if}}
        <a href="{{html_url}}" class="title">{{title}}</a>
      </h3>
      {{#if display_last_reply_at}}
        <small {{ contextSensitiveDatetimeTitle last_reply_at }}>{{#t}}Last post {{display_last_reply_at}}{{/t}}</small>
      {{/if}}
    </div>

    <div class="discussion-date-available">
      {{#with defaultDates}}
        {{#unless closed}}
          {{>[assignments/available_date_description]}}
        {{/unless}}
      {{/with}}
    </div>

    <div class="discussion-due-date">
      {{#if assignment}}
        <div class="ig-details__item assignment-date-due" data-view="date-due">
        </div>
      {{/if}}
    </div>

    {{#if permissions.update}}
      {{#if assignment}}
        {{#if cyoe.isTrigger}}
        <div>
          <a href="discussion_topics/{{id}}/edit?return_to={{return_to}}#mastery-paths-editor" title="{{#t}}Edit Mastery Paths for {{title}}{{/t}}">{{#t}}Mastery Paths{{/t}}</a>
        </div>
        {{/if}}
        {{#if cyoe.isReleased}}
        <span class="pill mastery-path-icon" aria-hidden="true" data-tooltip title="{{#t}}Released by Mastery Path: {{cyoe.releasedLabel}}{{/t}}">
          {{> icons/mastery-path}}{{cyoe.releasedLabel}}
        </span>
        <span class="screenreader-only">{{#t}}Released by Mastery Path: {{cyoe.releasedLabel}}{{/t}}</span>
        {{/if}}
      {{/if}}
    {{/if}}

    <div class="discussion-status">
      <span data-view="lock-icon" class="lock-icon"></span>
      <span id="publish-icon" class="publish-icon" data-view="publishIcon"></span>
      <a href="#" data-view="toggleableSubscriptionIcon" class="subscription-toggler" role="button"></a>
    </div>

    <div class="discussion-unread-status">
      {{#unless isRootTopic}}
      <div class="new-and-total-badge pull-right">
        <span class="new-items"
              title="{{unread_count_tooltip}}"
              aria-hidden="true"
              data-tooltip>
          {{n unread_count}}
        </span>
        <span class="screenreader-only">
          {{unread_count_tooltip}}
        </span>

        <div class="total-items"
             title="{{reply_count_tooltip}}"
             aria-hidden="true"
             data-tooltip>
          {{n discussion_subentry_count}}
        </div>
        <div class="screenreader-only">
          {{reply_count_tooltip}}
        </div>
      </div>
      {{/unless}}
    </div>

    <div class="discussion-actions">
      {{#if permissions.delete}}
        <a href="#" class="al-trigger al-trigger-gray" role="button" id="manage_link">
          {{> icons/settings}}
          <span class="screenreader-only">{{#t}}Manage discussion {{title}}{{/t}}</span>
        </a>

        <ul class="al-options">
          {{#if locked}}
            <li>
              <a href="#" class="icon-lock">
                {{#t}}Open for Comments{{/t}}
              </a>
            </li>
          {{else}}
            {{#if can_lock}}
              <li>
                <a href="#" class="icon-lock">
                  {{#t}}Close for Comments{{/t}}
                </a>
              </li>
            {{/if}}
          {{/if}}
          {{#if pinnable}}
            <li>
              <a href="#" class="icon-pin">
                {{#if pinned}}
                  {{#t}}Unpin{{/t}}
                {{else}}
                  {{#t}}Pin{{/t}}
                {{/if}}
              </a>
            </li>
            {{#if pinned}}
              <li>
                <a href="#"
                  class="move_item icon-updown"
                >{{#t}}Move To&hellip;{{/t}}</a>
              </li>
            {{/if}}
          {{/if}}
          {{#if ENV.permissions.manage_content}}
            <li>
              <a href="#" title="{{#t}}Duplicate Discussion {{title}}{{/t}}"
              aria-label="{{#t}}Duplicate Discussion {{title}}{{/t}}"
              class="icon-copy-course duplicate-discussion">
                {{#t}}Duplicate{{/t}}
              </a>
            </li>
          {{/if}}
          {{#if cyoe.isCyoeAble}}
          <li>
            <a href="discussion_topics/{{id}}/edit?return_to={{return_to}}#mastery-paths-editor" class="icon-mastery-path" title="{{#t}}Edit Mastery Paths for {{title}}{{/t}}">{{#t}}Mastery Paths{{/t}}</a>
          </li>
          {{/if}}
          {{#unless cannot_delete_by_master_course}}
            <li>
              <a href="#" class="icon-trash" title="{{#t}}Delete{{/t}}">{{#t}}Delete{{/t}}</a>
            </li>
          {{/unless}}
          {{#if ENV.permissions.manage_content}}
            {{>ExternalTools/external_tools_menu discussion_topic_menu_tools}}
          {{/if}}
        </ul>
      {{/if}}
    </div>
  </div>
</div>
